package com.wantup.demo.controller;

import com.wantup.demo.domain.User;
import com.wantup.demo.serivice.FluxService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * @author zhapluowei
 * @date 2018-11-23 0:36
 */
@RequestMapping("/api/v1/user")
@RestController
public class FluxController {

    private final FluxService userService;

    public FluxController(final FluxService userService) {
        this.userService = userService;
    }


    @GetMapping("test")
    public Mono<String> fluxHello(){

        return Mono.just("hello");
    }

    @GetMapping("find")
    public Mono<User> findById(final String id){
        return userService.getUserById(id);
    }

}
